﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Linq;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using DAL_NhaSach;
using BLL_NhaSach;

namespace AppQlyNhaSach.DangNhap
{
    public partial class frmLogin : DevExpress.XtraEditors.XtraForm
    {
        NhanVienBLL nv;
        public frmLogin()
        {
            InitializeComponent();
        }

        private void btnDangnhap_Click(object sender, EventArgs e)
        {
            if (nv.dangNhap(txtUser.Text, txtPass.Text) != null)
            {
                MessageBox.Show("Đăng nhập thành công!");
                frmMainNS frm = new frmMainNS();
                frm.username = txtUser.Text;
                frm.pass = txtPass.Text;
                frm.Show();
                this.Close();
            }
            else
            {
                MessageBox.Show("Sai tài khoản hoặc mật khẩu!");
            }
        }

        private void frmLogin_Load(object sender, EventArgs e)
        {
          nv = new NhanVienBLL(Properties.Settings.Default.ConnectionStringUser);
        }
    }
}